package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.zr.model.Cdisstation;
import com.zr.service.OptionService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@Scope(value="prototype")
public class OptionAction extends ActionSupport implements ServletResponseAware{
   private HttpServletResponse resp;

	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		this.resp=arg0;
	}
	
	@Resource
	private OptionService optionService;
	//获取地址
    public void option(){
	  resp.setCharacterEncoding("utf8");
	  JSONArray  jsa= optionService.getDisname();
	  try {
		PrintWriter pw=resp.getWriter();
		pw.write(jsa.toString());
	} catch (IOException e) {
		e.printStackTrace();
	}  
  }
    //获取订单状态
    public void ostate(){
    	resp.setCharacterEncoding("utf8");
  	  JSONArray  jsa= optionService.getOstate();
  	  try {
  		PrintWriter pw=resp.getWriter();
  		pw.write(jsa.toString());
  	} catch (IOException e) {
  		e.printStackTrace();
  	}  
    }
    //获取订单类型
    public void otype(){
    	resp.setCharacterEncoding("utf8");
    	 JSONArray  jsa= optionService.getOtype();
     	  try {
     		PrintWriter pw=resp.getWriter();
     		pw.write(jsa.toString());
     	} catch (IOException e) {
     		e.printStackTrace();
     	}  
    }
    //获取物流状态
    public void logstate(){
    	resp.setCharacterEncoding("utf8");
    	 JSONArray  jsa= optionService.getLogstate();
     	  try {
     		PrintWriter pw=resp.getWriter();
     		pw.write(jsa.toString());
     	} catch (IOException e) {
     		e.printStackTrace();
     	}  
    }
    
    public void goodstype(){
    	resp.setCharacterEncoding("utf8");
    	 JSONArray  jsa= optionService.getgoodstype();
     	  try {
     		PrintWriter pw=resp.getWriter();
     		pw.write(jsa.toString());
     	} catch (IOException e) {
     		e.printStackTrace();
     	}  
    }
    
}
